package local

import (
	"github.com/container-storage-interface/spec/lib/go/csi"
	"google.golang.org/grpc"
)

type server struct {
	csi.UnimplementedIdentityServer
	csi.UnimplementedControllerServer
	csi.UnimplementedNodeServer
	identity   *identityServer
	controller *controllerServer
	node       *nodeServer
}

func NewServer() *server {
	return &server{
		identity:   &identityServer{},
		controller: &controllerServer{},
		node:       &nodeServer{},
	}
}

func (s *server) RegisterIdentityServer(srv *grpc.Server) {
	csi.RegisterIdentityServer(srv, s.identity)
}

func (s *server) RegisterControllerServer(srv *grpc.Server) {
	csi.RegisterControllerServer(srv, s.controller)
}

func (s *server) RegisterNodeServer(srv *grpc.Server) {
	csi.RegisterNodeServer(srv, s.node)
}
